package com.surelution.projects.crm

import java.util.Date;

class MarketGasSale {
	
	public static final String SUM_TYPE_MONTH = "m"
	public static final String SUM_TYPE_YEAR = "y"

    static constraints = {
		market(unique:['saleGasTime','sumType'])
    }
	static transients = ['amount']
	
	static belongsTo = [market:Market]
//	Market market
	Date saleGasTime
	
	/**
	 * 汽油销量
	 */
	Float saleNumber
	
	/**
	 * 柴油销量
	 */
	Float dieselOilNumber
	/**
	 * 柴汽油总销量
	 * @return
	 */
	Float getAmount() {
		saleNumber + dieselOilNumber
	}
	/**
	 * 为了更高效的统计出销量信息，系统采用批处理的方式来统计销量
	 * 系统可能有按照月度来统计、年度来统计，该值应该是 SUM_TYPE_MONTH 或 SUM_TYPE_YEAR
	 * 默认为SUM_TYPE_MONTH
	 */
	String sumType
}
